import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types';

const EmergencyAlertMeta: IPublicTypeComponentMetadata = {
  componentName: 'EmergencyAlert',
  title: '应急预警与响应',
  category: '信息展示',
  group: '应急管理',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'EmergencyAlert',
    main: 'src/index.tsx',
    destructuring: true,
    subName: ''
  },
  props: [
    {
      name: 'ref',
      propType: 'object',
    },
    {
      name: 'key',
      propType: 'string',
    },
    {
      name: 'style',
      propType: 'object',
    },
    {
      name: 'className',
      propType: 'string',
    },
    {
      name: 'width',
      propType: 'number',
      description: '组件宽度'
    },
    {
      name: 'height',
      propType: 'number',
      description: '组件高度'
    },
    {
      name: 'iconImage',
      propType: 'string',
      description: '图标图片'
    },
    {
      name: 'tabs',
      propType: 'array',
      description: '标签列表'
    },
    {
      name: 'records',
      propType: 'array',
      description: '记录列表'
    },
    {
      name: 'showTextShadow',
      propType: 'bool',
      description: '显示文字阴影'
    },
    {
      name: 'headerLabels',
      propType: 'object',
      description: '表头标签'
    },
    {
      name: 'theme',
      propType: 'string',
      description: '主题'
    },
    {
      name: 'onTabClick',
      propType: 'func',
      description: '标签点击事件'
    },
    {
      name: 'onRecordClick',
      propType: 'func',
      description: '记录点击事件'
    },
    {
      name: 'onClick',
      propType: 'func',
      description: '点击事件'
    }
  ],
  configure: {
    props: [
      {
        name: 'iconImage',
        title: { label: { type: 'i18n', 'en-US': 'iconImage', 'zh-CN': '图标图片' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: 'http://localhost:8085/static/images/yingjiguanli/bz5.png' }
      },
      {
        name: 'showTextShadow',
        title: { label: { type: 'i18n', 'en-US': 'showTextShadow', 'zh-CN': '显示文字阴影' } },
        setter: { componentName: 'BoolSetter', isRequired: false, initialValue: true }
      },
      {
        name: 'headerLabels.location',
        title: { label: { type: 'i18n', 'en-US': 'headerLabels.location', 'zh-CN': '监控位置标签' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: '监控位置' }
      },
      {
        name: 'headerLabels.time',
        title: { label: { type: 'i18n', 'en-US': 'headerLabels.time', 'zh-CN': '监控时间标签' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: '监控时间' }
      },
      {
        name: 'headerLabels.details',
        title: { label: { type: 'i18n', 'en-US': 'headerLabels.details', 'zh-CN': '告警详情标签' } },
        setter: { componentName: 'StringSetter', isRequired: false, initialValue: '告警详情' }
      }
    ],
    supports: {
      style: true
    }
  }
};

const snippets: IPublicTypeSnippet[] = [
  {
    title: '应急预警与响应',
    screenshot: '',
    schema: {
      componentName: 'EmergencyAlert',
      props: {
        width: 500,
        height: 1080,
        iconImage: 'http://localhost:8085/static/images/yingjiguanli/bz5.png',
        iconSize: {
          width: 20,
          height: 20
        },
        tabs: [
          { id: 'tab1', text: '月', isActive: true },
          { id: 'tab2', text: '年', isActive: false },
        ],
        headerBackgroundImage: 'http://localhost:8085/static/images/yingjiguanli/dhan.png',
        tableHeaderBackgroundImage: 'http://localhost:8085/static/images/yingjiguanli/bz6.png',
        tableRowBackgroundImage: 'http://localhost:8085/static/images/yingjiguanli/Frame26.png',
        records: [
          { id: '1', title: '事件名称', month: '07-01', address: '华阳老街是这里呀', type: '问题分类',  expiring: '一级'},
          { id: '2', title: '事件名称', month: '07-02', address: '地址', type: '问题分类', expiring: '一级' },
          { id: '3', title: '事件名称', month: '07-03', address: '地址', type: '问题分类', expiring: '一级' },
          { id: '4', title: '事件名称', month: '07-04', address: '地址', type: '问题分类', expiring: '一级' },
          { id: '5', title: '事件名称', month: '07-04', address: '地址', type: '问题分类', expiring: '一级' },
          { id: '6', title: '事件名称', month: '07-04', address: '地址', type: '问题分类', expiring: '一级' },
          { id: '7', title: '事件名称', month: '07-04', address: '地址', type: '问题分类', expiring: '一级' },
          { id: '8', title: '事件名称', month: '07-04', address: '地址', type: '问题分类', expiring: '一级' },
          { id: '9', title: '事件名称', month: '07-04', address: '地址', type: '问题分类', expiring: '一级' },
        ],
        showTextShadow: true,
        headerLabels: {
          location: '监控位置',
          time: '监控时间',
          details: '告警详情'
        },
        theme: 'dark'
      }
    }
  }
];

export default {
  ...EmergencyAlertMeta,
  snippets
};
